var barcodeMasterController = require('../../../Barcode/server/controllers/BarcodeMaster.server.controller'),
    bizRecordController = require('../../../Barcode/server/controllers/BizRecord.server.controller'),
    rcvRecordController = require('../../../ProduceWork/server/controllers/RcvRecord.server.controller');

// 服务器连接测试接口
exports.connectTest = function(req, res) {
    res.json({
        Data: '测试通过',
        error: null
    });
};

//生产批次产量分布看板
exports.findAllBarcodeMasterByLotNum = function(req, res) {
    var parameter = req.body.Parameter;
    var MOLotNumber = parameter.MOLotNumber;
    barcodeMasterController.findAllBarcodeMaster(MOLotNumber, function(err, result) {
        if (err) {
            res.json({
                data: null,
                error: err
            });
        } else {
            res.json({
                data: result,
                error: null
            });
        }
    });
};
//质量预警(按时间分组)
exports.getBarcodeMasterByDate = function(req, res) {
    bizRecordController.qualityWaring(function(err, result) {
        if (err) {
            res.json({
                data: null,
                Error: err
            });
        } else {
            res.json({
                data: result,
                Error: null
            });
        }

    });
};

//查询完工日报
exports.queryCompletionDaily = function(req, res) {
    rcvRecordController.queryRcvRecords(function(err, result) {
        if (err) {
            res.json({
                Data: null,
                Error: err

            });
        } else {
            res.json({
                Data: result,
                Error: null
            });
        }
    });
};
